<?php
namespace app\admin\controller;
use app\admin\code\BaseCode;
use app\admin\logic\AdLogic;
use app\admin\model\AdModel;
use app\admin\model\SiteConfigModel;
use app\admin\util\Page;
use app\admin\util\Response;
use app\admin\validate\AdValidate;
use think\Cache;
use think\Request;

class System extends Base
{
    public function index(){
        $model = new SiteConfigModel();
        $list = $model->select();
        $this->assign('list',$list);
        return view();
    }
    public function update(){
        $param = Request::instance()->request();
        $model = new SiteConfigModel();
        foreach ($param as $key=>$value){
            $model->isUpdate(true)->save(['value'=>$value],['id'=>$key]);
        }
        Cache::clear();
        Response::json(BaseCode::SUCCESS);
    }
}